//% color="#ff9f06" iconWidth=50 iconHeight=40
namespace AHT20{
    
    //% block="AHT20 temperature and humidity sensor initialized with I2C address 0x38" blockType="command"  
    export function AHT20_init(parameter: any, block: any) { 

        Generator.addImport('from pinpong.board import Board,Pin');
        Generator.addImport('from pinpong.libs.dfrobot_aht20 import AHT20');
        Generator.addInit(`board_begin`,`Board().begin()`);
        Generator.addInit(`aht`,`aht20 = AHT20()`);
   
    }
    
    //% block="Read AHT20 temperature humidity sensor [DATA]" blockType="reporter"  
    //% DATA.shadow="dropdown" DATA.options="DATA"
    export function AHT20_data(parameter: any, block: any) { 
        let data=parameter.DATA.code;

        Generator.addCode(`aht20.${data}`)
   
    }

}

